#ifndef GAME_H
#define GAME_H

#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>
#include <vector>
#include <D3dx9math.h>

#pragma comment (lib, "dxguid.lib")
#pragma comment (lib, "d3dx9d.lib")
#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "winmm.lib")
#pragma comment (lib, "dsound.lib")
#pragma comment (lib, "dinput8.lib")
#pragma comment (lib, "dxerr.lib")

#include "Singleton.h"
#include "GameState.h"

#include "Socket.h"
#include "GameMessage.h"

class Game
{
public:
	void Init();
	void Clean();

	void ChangeState(GameState* state);
	void PushState(GameState* state);
	void PopState();

	void HandleInput();
	void HandleCollisions();

	void Update(float dt);
	void Render();

	void SetSock(Socket* s);
	Socket* GetSock();

	float GetTime();
	int GetFPS(){return m_FPS;}

	D3DMATRIX GetProj();
	
	IDirect3DVertexDeclaration9* m_VertexDec;
private:
	Game();
	std::vector<GameState*> m_States;
	D3DXMATRIX m_matProjection;  
	friend class Singleton<Game>;
	float m_GameTime;
	Socket* m_Sock;
	float m_FPS;
	float m_lastFPSUpdate;
	int m_frames;
};

typedef Singleton<Game> TheGame;

#endif
